package com.woniuxy02;

import java.util.*;

/**
 * @author 作者
 * @create 2025-06-09 14:08
 */
public class Test02 {
    //ArrayList嵌套Map
    public static void main(String[] args) {
        //两个学生
        Student s11=new Student("1","zs",11);
        Student s12=new Student("2","ls",12);
        //第一个班级，存放这两个学生
        Map<String,Student> class1=new HashMap<>();
        class1.put(s11.getId(),s11);
        class1.put(s12.getId(),s11);
        //两个学生
        Student s21=new Student("1","ww",11);
        Student s22=new Student("2","zl",12);
        Map<String,Student> class2=new HashMap<>();
        class2.put(s21.getId(),s11);
        class2.put(s22.getId(),s11);

        ArrayList<Map<String,Student>> school=new ArrayList<>();
        school.add(class1);
        school.add(class2);

        System.out.println(school);
        for(Map<String,Student> myclass :school){
            Set<Map.Entry<String,Student>> entries= myclass.entrySet();
            for(Map.Entry<String,Student> entry  :entries){
                System.out.println(entry.getKey());
                System.out.println(entry.getValue());
            }
            System.out.println("------------------------------");
        }

    }
}
